package com.superm.controller;

import com.superm.entity.RepostoryType;
import com.superm.entity.ShelfComeoutPoJo;
import com.superm.service.RepostoryService;
import com.superm.service.ShelfComeoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/ShelfComeout")
public class ShelfComeoutController {


    @Autowired
    private ShelfComeoutService shelfComeoutService;

    @Autowired
    private RepostoryService repostoryService;
    /**
     * 跳转至上架出库单
     * @return
     */
    @RequestMapping("/skipShelfComeout")
    public ModelAndView skipShelfComeout(){
        ModelAndView mv = new ModelAndView("shelfComeout/shelfComeoutList");
        //查询所有仓库
      List<RepostoryType> repostoryTypes =  repostoryService.allRepostory();
      mv.addObject("repostoryTypes",repostoryTypes);
        return mv;
    }

    /**
     * 模糊查询上架出库单
     * @return
     */
    @RequestMapping("likeShelfComeout")
    @ResponseBody
    public Map<String,Object> likeShelfComeout(ShelfComeoutPoJo shelfComeoutPoJo,@RequestParam("page") Integer pageNo,@RequestParam("limit")Integer pageSize){
      Map<String,Object> map = shelfComeoutService.likeShelfComout(shelfComeoutPoJo,pageNo,pageSize);
      return map;
    }


}
